package xworker.lang.util.codeassist.objectassists;

import org.xmeta.ActionContext;
import org.xmeta.Thing;
import org.xmeta.util.ActionContainer;
import xworker.lang.VariableDesc;
import xworker.lang.util.codeassist.CodeAssitContent;
import xworker.lang.util.codeassist.ObjectAssistor;

import java.util.ArrayList;
import java.util.List;

public class ActionContainerAssistor implements ObjectAssistor {

	@Override
	public List<CodeAssitContent> getContents(VariableDesc var, Thing thing, ActionContext actionContext) {
		List<CodeAssitContent> list = new ArrayList<>();
		ClassAssistor.initContents("org.xmeta.util.ActionContainer", list);
		
		if(var.getThing() != null) {
			ActionContainer ac = new ActionContainer(var.getThing(), actionContext);
			//获取动作列表
			for(Thing acthing : ac.getActionThings()){
				list.add(ThingAssistor.getActionAssistString(acthing));
			}
		}
		return list;
	}
}
